TARGET=a.out


CC = gcc
RM = rm -f



UNIT_TEST_C_PATH = $(shell pwd)
include $(UNIT_TEST_C_PATH)/unit_test_for_c.mk


TEST_CSRCS += $(shell find test/ -type f -name '*.c')

COBJS += $(patsubst %.c, %.o, $(CSRCS))
TEST_COBJS += $(patsubst %.c, %.o, $(TEST_CSRCS))


OBJS += $(COBJS)


all: $(OBJS)


test: $(OBJS) $(TEST_COBJS)
	$(CC) $(CFLAGS) -o $(TARGET) $^ $(LDFLAGS)

run: test
	./$(TARGET)


%.o: %.c
	$(CC) $(CFLAGS) -o $@ -c $<


clean:
	$(RM) $(OBJS) $(TEST_COBJS) $(TARGET)
	$(RM) -r docs

docs:
	doxygen Doxyfile



.PHONY: all clean docs test run
